package com.example.coursehub.entity;

import java.io.Serializable;
import java.util.Objects;

import org.hibernate.Hibernate;

import jakarta.persistence.Column;
import jakarta.persistence.Embeddable;
import lombok.Getter;
import lombok.Setter;

@Getter
@Setter
@Embeddable
public class ExerciseQuestionId implements Serializable {
    private static final long serialVersionUID = -8106841779482810694L;
    @Column(name = "exercise_id", nullable = false, length = 100)
    private String exerciseId;

    @Column(name = "question_id", nullable = false, length = 100)
    private String questionId;

    @Override
    public boolean equals(Object o) {
        if (this == o) return true;
        if (o == null || Hibernate.getClass(this) != Hibernate.getClass(o)) return false;
        ExerciseQuestionId entity = (ExerciseQuestionId) o;
        return Objects.equals(this.questionId, entity.questionId) &&
                Objects.equals(this.exerciseId, entity.exerciseId);
    }

    @Override
    public int hashCode() {
        return Objects.hash(questionId, exerciseId);
    }
    
}